<template>
  <div class="container">
    <div class="header">
      <div class="title">{{ title }}</div>
      <div class="more"><a href="javascript:;">查看更多 ></a></div>
    </div>
    <div class="list">
      <div class="left-list">
        <img :src="imgBig" alt="" />
      </div>
      <div class="right-list">
        <ul>
          <li v-for="(item, index) in dataList" :key="index" @click="toBuy(item)">
            <img :src="/^\d/.test(item.img) ? require('/src/assets/images/main/body/phone/phoneType/'+item.img) : item.img" alt="" />
            <h3>{{ item.title }}</h3>
            <p>{{ item.describe }}</p>
            <p>{{ item.price }}</p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
export default {
  name: "CommonCategory",
  props: ["phoneInfo", "noteBookInfo"],
  setup(props) {
    const router = useRouter();
    function toBuy(val) {
      router.push({ name: "buy", params: {...val} });
    }
    return {
      ...props.phoneInfo,
      ...props.noteBookInfo,
      toBuy,
    };
  },
};
</script>

<style lang="less" scoped>
.container {
  margin-bottom: 30px;
  .header {
    display: flex;
    justify-content: space-between;
    div {
      font-size: 22px;
      color: #333;
    }
    .more {
      a {
        font-size: 22px;
        color: #333;
        &:hover {
          color: #409eff;
        }
      }
    }
  }
  .list {
    display: flex;
    margin-top: 20px;
    height: 628px;
    .left-list {
      width: 234px;
      background-color: #fff;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .right-list {
      width: calc(100% - 234px);
      ul {
        display: flex;
        flex-wrap: wrap;
        align-content: space-between;
        height: 100%;
        li {
          margin-left: 13px;
          width: 234px;
          height: 300px;
          background-color: #fff;
          text-align: center;
          img {
            width: 160px;
            height: 160px;
            margin: 10px 0;
          }
          p {
            &:nth-of-type(1) {
              margin: 8px 0 13px 0;
              font-size: 14px;
              color: #b0b0b0;
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
            }
            &:nth-of-type(2) {
              font-size: 14px;
              color: red;
            }
          }
        }
      }
    }
    .left-list,
    .right-list ul li {
      transition: .5s;
      cursor: pointer;
      &:hover {
        transform: translateZ(5px) translateY(-5px);
        box-shadow: 0 0 16px rgba(0, 0, 0, 0.3);
      }
    }
  }
}
</style>